package yl.hs.bmipfull.controllers.system;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.service.system.ISearchViewService;
import yl.hs.bmipfull.service.system.ISystemLogService;
import yl.hs.bmipfull.viewmodels.PageQuery;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * SysLogController
 *
 * @author 谢景广 date 2021-05-10
 * @category
 */
@Api(value = "核心系统日志Web接口", tags = "系统管理——核心系统日志")
@RequestMapping(path = "/api/system/log")
@RestController
public class SysLogController extends ControllerBase {
    @Autowired
    ISystemLogService logService;
    @Autowired
    ISearchViewService svSVC;

    @ApiOperation(value = "查询所有核心系统日志", notes = "查询核心系统日志信息")
    @RequestMapping(path = "/{rowNum}/{page}", method = RequestMethod.POST)
    @ResponseBody
    public WebResult queryAll(@RequestBody PageQuery query, @PathVariable int page, @PathVariable int rowNum) {
        try {
            var result = logService.queryLogPage(query, rowNum, page);
            svSVC.updateUserMenuView(query);
            return success("ok", result);
        } catch (Exception ee) {
            return error(ee);
        }
    }
}
